<template>
  <!-- 绩效考核-->
  <div>
    <div v-show="this.dateList.audit === '1'">
      <h1>审核结果汇总</h1>
      <el-table :data="sumTableData" stripe border style="width: 100%">
        <el-table-column prop="ERROR" label="问题所在" align="center" width="900"></el-table-column>
        <el-table-column prop="ls" label="例数" align="center" width></el-table-column>
        <el-table-column prop="zb" label="%" align="center" width="140"></el-table-column>
        <el-table-column prop="ZT" label="类型" align="center" width></el-table-column>
      </el-table>
    </div>
    <div v-show="this.dateList.audit === '2'">
      <h1>审核结果</h1>
      <el-table :data="tableData" stripe border style="width: 100%">
        <el-table-column prop="dm" label="病案号" align="center" width></el-table-column>
        <el-table-column prop="error" label="问题所在" align="center" width="900"></el-table-column>
        <el-table-column prop="zt" label="类型" align="center" width></el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
import { generateReportCsv, generateCsv } from "@/api";
import { showOkMsg, showErrorMsg } from "@/utils/index.js";

export default {
  data() {
    return {
      sumTableData: [],
      tableData: [],
      url: ""
    };
  },
  props: ["dateList"],
  methods: {
    getTableList() {
      if (this.dateList.dateBegin && this.dateList.dateEnd) {
        this.$emit("loadFun", true);
        generateReportCsv({
          endTime: this.dateList.dateEnd,
          startTime: this.dateList.dateBegin
        })
          .then(res => {
            if (res.code === 0) {
              this.sumTableData = res.data.summary;
              this.tableData = res.data.detailed;
              this.$emit("fun", 1, false);
              this.$emit("loadFun", false);
            } else if (res.code === 1010) {
              this.sumTableData = [];
              this.tableData = [];
              this.$emit("fun", 0, false);
              this.$emit("loadFun", false);
              showOkMsg(res.msg);
            } else {
              this.$emit("loadFun", false);
            }
          })
          .catch(err => {
            this.$emit("loadFun", false);
          });
      } else {
        showErrorMsg("请选择日期");
      }
    }
  }
};
</script>

<style scoped>
h1 {
  font-size: 24px;
  text-align: center;
  padding: 23px 0;
}
h3 {
  text-align: center;
  padding-bottom: 20px;
}
h2 {
  padding: 4px 0;
  display: flex;
  justify-content: space-between;
}
</style>